Repository navigation
feat(router): serial vLLM Mooncake legs (INFERA_VLLM_MOONCAKE_SERIAL=1) - #246
Closed
llying-001 wants to merge 1 commit into
Closed
llying-001 wants to merge 1 commit into
llying-001 wants to merge 1 commit into
Conversation
With vLLM's MooncakeConnector the router posts the prefill and decode legs concurrently. The decode reserves KV for a request as soon as its leg arrives, while a prefill that reorders its queue (cache-aware admission, priority) can hold finished KV the decode has not reserved yet; under memory pressure each side then waits on the other and the deployment stalls. INFERA_VLLM_MOONCAKE_SERIAL=1 posts the decode only after the prefill has answered, in both routers: - Python: VllmMooncakeProtocol.topology becomes serial-pull (the existing serial dispatcher; the decode needs no handoff from the prefill reply, the room is in both bodies). - Rust: vllm_serial_pull posts the prefill, waits for its reply and then runs the decode leg through serial_decode, shared with ATOM's serial_pull; a failed prefill is returned to the client and never reaches the decode. Tests: the Python protocol switches topology and pairs the transfer ids; the Rust test checks the decode is not posted while the prefill is still running, and is never posted after a failed prefill. Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
7 of 8 tasks
llying-001
added a commit
that referenced
this pull request
Nov 19, 2026
…y repo at the user's request: AMD-AGI/Infera #246 (U16) #247 (U24) #248 (U14) #249 (U15) #250 (U28) #251 (U7), branches llying/<topic>, conventional titles; fork PRs llying-001/Infera #1-#6 closed and pointed at them Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
llying-001
marked this pull request as ready for review
November 23, 2026 14:21
llying-001
requested review from
jiejingzhangamd,
limou102 and
xiaobochen-amd
as code owners
November 23, 2026 14:21
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The serial Mooncake paths in both routers bypass NATS transport and admission checks, causing requests to fail for NATS-only workers or bypass configured backlog limits.
2 open issues
What changed in this PR
Adds opt-in serial dispatch for vLLM Mooncake prefill and decode requests in both routers to address KV-memory stalls. Concurrent dispatch remains the default.
Changes:
- Enables Python’s existing serial dispatcher with
INFERA_VLLM_MOONCAKE_SERIAL=1. - Adds Rust serial Mooncake dispatch, sharing decode handling with ATOM and stopping on prefill failure.
- Adds tests for Python topology selection and transfer IDs, plus Rust request ordering and prefill-failure handling.
| File | Description |
|---|---|
tests/unit/router/test_vllm_mooncake_protocol.py |
Tests serial topology selection and matching transfer IDs. |
rust/router/src/disagg.rs |
Adds serial Mooncake dispatch, shared decode handling, and sequencing tests. |
infera/router/disagg_protocols/vllm_mooncake.py |
Selects serial topology through the environment variable and clarifies handoff behavior. |
Review effort: Balanced
Comment on lines
+59
to
+61
| topology: Literal["concurrent", "serial-pull"] = ( | ||
| "serial-pull" if os.environ.get("INFERA_VLLM_MOONCAKE_SERIAL") == "1" else "concurrent" | ||
| ) |
Comment on lines
+178
to
+179
| if proto == protocol::PdProtocol::VllmMooncake && vllm_mooncake_serial() { | ||
| return vllm_serial_pull(state, &p, &d, path, p_body, d_body, stream, guard).await; |
llying-001
added a commit
that referenced
this pull request
Nov 23, 2026
…of the 10 PRs against vLLM main afb35f85e (239 commits past the PR base) and Infera main (unchanged): U11 duplicated by upstream draft #69348 (not submitted); U13 half covered by merged #68006, needs the reworked patch (U13-rework-on-afb35f85e.patch, not run) and re-verification; U17 / U19 not upstream, review passed, not opened on vllm-project/vllm (AGENTS.md needs the submitter's own line-by-line review), U19 coupled with open #69254; Infera #246-#251 reviewed and marked ready Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: liyingli <liyingli@amd.com>
9 of 12 tasks
Contributor
Author
|
Folded into #256 (GLM-5.2 vLLM P4D4 example, image and the infera changes it needs); the commit is carried there unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
With vLLM's MooncakeConnector the router posts the prefill and decode legs of a PD request concurrently. The decode
reserves KV for a request as soon as its leg arrives, while a prefill that reorders its queue (cache-aware admission,
priority) can hold finished KV that the decode has not reserved yet. Under memory pressure each side then waits on the
other and the deployment stalls: on a GLM-5.2 PD deployment (8x MI355X, prefill PP4 with cache-aware admission, decode
DP4) the prefill sat at 0 running / 76 waiting / 99.7% KV with zero prompt throughput, and client responses stopped
for over a minute.
INFERA_VLLM_MOONCAKE_SERIAL=1posts the decode leg only after the prefill has answered, in both routers. The Pythonrouter already had a serial-pull dispatcher; the Rust router only had a serial path for ATOM.
Type of change
Changes
VllmMooncakeProtocol.topologybecomesserial-pullwhen the variable is set (the existing serialdispatcher; the decode needs no handoff from the prefill reply, the transfer room is in both bodies).
vllm_serial_pullposts the prefill, waits for its reply, then runs the decode leg throughserial_decode,shared with ATOM's serial pull; a failed prefill is returned to the client and never reaches the decode.
Validation
pytest -m "not slow and not integration", Python 3.10): 3,055 passed (main 3,054), no newfailures. New: the protocol switches topology and pairs the transfer ids.
cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo test --locked): clean, 370passed (main 369). New:
disagg::tests::vllm_serial_pull_posts_the_decode_after_the_prefill_replychecks the decodeis not posted while the prefill is running, and is never posted after a failed prefill.
pre-commit run --files <changed files>passes.path, AgentX C104) completed without a stall, e.g. 48,572 tok/s/GPU over 3600 s (single runs).
Notes: the switch is an environment variable, like the Python router's existing one; happy to turn it into a router CLI
flag instead. AI assistance was used to write this change and description.
Checklist: